package com.foreveross.crawl.common.application;

import java.util.List;

import com.foreveross.crawl.vo.ProxyChannelRelateVO;

public interface IProxyChannelRelateApplication {

	/**  
	 * @Description: 保存代理IP
	 * @param vo
	 * @return
	 * @author luofangyi
	 * @date 2014-10-16 下午3:13:38 
	 */ 
	public void saveProxyIp(ProxyChannelRelateVO vo) throws Exception;
	
	/**  
	 * @Description: 保存渠道信息
	 * @param vo
	 * @return
	 * @author luofangyi
	 * @date 2014-10-16 下午3:14:02 
	 */ 
	public void saveChannelInfo(ProxyChannelRelateVO vo) throws Exception;
	
	/**  
	 * @Description: 增加或修改执行成功的代理IP信息
	 * @param channelId 渠道ID
	 * @param channelName 渠道名称
	 * @param ip IP地址
	 * @throws Exception
	 * @author luofangyi
	 * @date 2014-10-17 下午4:31:38 
	 */ 
	public void saveOrUpdateProxyIp(Long channelId, String channelName, String ip) throws Exception;
	
	/**  
	 * @Description: 增加或修改代理IP信息
	 * @param channelId 渠道ID
	 * @param channelName 渠道名称
	 * @param ip IP地址
	 * @param isSuccess 是否成功
	 * @throws Exception
	 * @author luofangyi
	 * @date 2014-10-17 下午4:31:38 
	 */ 
	public void saveOrUpdateProxyIp(Long channelId, String channelName, String ip, boolean isSuccess) throws Exception;
	
	/**  
	 * @Description: 保存代理ip渠道信息关联关系
	 * @param vo
	 * @throws Exception
	 * @author luofangyi
	 * @date 2014-10-16 下午4:06:25 
	 */ 
	public void saveProxyChannelRelate(ProxyChannelRelateVO vo) throws Exception;
	
	public void deleteAllProxyIp();
	
	public void deleteAllChannelInfo();
	
	public void deleteAllProxyChannelRelate();
	
	/**  
	 * @Description: 删除所有代理IP、渠道、关联关系信息
	 * @author luofangyi
	 * @date 2014-10-16 下午4:14:25 
	 */ 
	public void clearAll();
	
	/**  
	 * @Description: 更新代理ip成功执行次数
	 * @param channelId
	 * @param proxyIp
	 * @author luofangyi
	 * @date 2014-10-16 下午3:21:18 
	 */ 
	public void updateProxyIpOfSuccessNumber(Long channelId, String proxyIp);
	
	/**  
	 * @Description: 更新代理ip失败次数
	 * @param channelId
	 * @param proxyIp
	 * @author luofangyi
	 * @date 2014-10-16 下午3:21:44 
	 */ 
	public void updateProxyIpOfFailNumber(Long channelId, String proxyIp);
	
	/**  
	 * @Description: 根据ip获取代理ip信息
	 * @param ip
	 * @return
	 * @author luofangyi
	 * @throws Exception 
	 * @date 2014-10-16 下午4:19:29 
	 */ 
	public ProxyChannelRelateVO getProxyIpByIp(String ip) throws Exception;
	
	/**  
	 * @Description: 根据渠道ID获取渠道信息
	 * @param channelId
	 * @return
	 * @author luofangyi
	 * @throws Exception 
	 * @date 2014-10-16 下午4:20:13 
	 */ 
	public ProxyChannelRelateVO getChannelInfoByChannelId(Long channelId) throws Exception;
	
	/**  
	 * @Description: 以渠道信息为维度统计代理ip信息
	 * @return
	 * @author luofangyi
	 * @date 2014-10-16 下午3:25:07 
	 */ 
	public List<ProxyChannelRelateVO> getStatisticsByChannel(int pageCurrent, int pageSize);
	
	/**  
	 * @Description: 以渠道信息为维度统计指定proxyIp的信息
	 * @return
	 * @author luofangyi
	 * @date 2014-10-16 下午3:28:17 
	 */ 
	public List<ProxyChannelRelateVO> getStatisticsByProxyIp(String proxyIp, int pageCurrent, int pageSize);
	
}
